<template>
  <div>
    <div v-for="(option, index) in options" :key="index">
      <Row :gutter="32" prop="control" class="code-row-bg">
        <Col span="14">
          <Input fieldType="text" :maxlength="30" v-model="option.text" placeholder="请输入"></Input>
        </Col>
        <Col span="4">
          <Icon type="ios-trash-outline" color="#f89c34" size="22" @click="removeOption(index)" />
        </Col>
      </Row>
    </div>
  </div>
</template>

<script>
import { mapState } from 'vuex'
export default {
  data() {
    return {
      options: []
    }
  },
  computed: {
    ...mapState(['orgList']),
  },
  methods: {
    removeOption(index) {
      this.options.splice(index, 1)
    },
  },
  created() {
    this.options = this.orgList.map(item => {
      return {
        text: item.orgName,
        value: item.orgCode,
      }
    })
    this.$emit("SetTitle", "快速导入单位");
    this.$emit("SetPageActions", [
      {
        text: "确定",
        theme: "primary",
        handle: () => {
          this.$emit("Close", this.options);
        }
      },
      {
        text: "取消",
        handle: () => {
          this.$emit("Close");
        }
      }
    ]);
     this.$emit("SetPageMaxHeight", 400);
     this.$emit("SetPageWidth", 600);
  },
}
</script>

<style lang="scss" scoped>

</style>